<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <ui:composition template="shared/_layout.xhtml">
        <ui:define name="css">
            <h:outputStylesheet name="home.css" library="css" />
        </ui:define>
        <ui:define name="content">
            <article>
                <h1>
                    <h:outputText value="#{lang._home_welcome}"/>
                </h1>
                <section>
                    <h2>
                        <h:outputText value="#{lang._home_most_purchased}"/>
                    </h2>
                    <ul id="most-purchased">
                        <c:forEach items="#{home.books}" var="book">
                            <li>
                                <h:form>
                                    <h:commandLink action="#{library.selectArticle(book)}">
                                        <div class="book">
                                            <h:graphicImage alt="#{book.idArticles.name}" class="book-image" library="img/books" name="#{book.idArticles.image}" height="150" width="100"/>
                                            <div class="book-informations">
                                                <h3>
                                                    <h:outputText value="#{book.idArticles.name} "/> 
                                                    <h:outputText class="book-author" value="#{book.idAuthors.name}"/>
                                                </h3>
                                                <div class="book-price">
                                                    <h:outputText value="#{book.idArticles.price}€"/>
                                                </div>
                                            </div>
                                        </div>
                                    </h:commandLink>
                                </h:form>
                            </li>
                        </c:forEach>
                    </ul>
                </section>
            </article>
        </ui:define>
    </ui:composition>
</html>